package qingke.hibernate.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;



@Table(name = "student")
@Entity
public class Student {
	@Id
	@Column(name="id")
	private int id;
	@Column(name="firstname")
	private String firstname;
	@Column(name="lastname")
	private String lastname;
	@Column(name="gender")
	private String gender;
	@Column(name="phone")
	private String phone;
	@Column(name="email")
	private String email;
	@Column(name="height")
	private int height;
	@Column(name="age")
	private int age;
	
	@OneToOne
	@PrimaryKeyJoinColumn
	private StudentLogin login;
	
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "student_status_id")
	private StudentStatus status;
	
	@OneToMany
	@JoinColumn(name = "student_id")
	private Set<Accommodation> accommodation ;
	
	@OneToMany
	@JoinColumn(name = "student_id")
	private Set<Register> register;
	
	@OneToMany
	@JoinColumn(name = "student_id")
	private Set<CourseSelect> courseSelect;
	
	public Student(){
		
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	public StudentLogin getLogin() {
		return login;
	}
	public void setLogin(StudentLogin login) {
		this.login = login;
	}
//	@Override
//	public String toString() {
//		return "Student [id=" + id + ", firstname=" + firstname + ", lastname=" + lastname + ", gender=" + gender
//				+ ", phone=" + phone + ", email=" + email + ", height=" + height + "]";
//	}
	@Override
	public String toString() {
		return "Student [id=" + id + ", firstname=" + firstname + ", lastname=" + lastname + ", gender=" + gender
				+ ", phone=" + phone + ", email=" + email + ", height=" + height +"]";
	}
	public StudentStatus getStatus() {
		return status;
	}
	public void setStatus(StudentStatus status) {
		this.status = status;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public Set<Accommodation> getAccommodation() {
		return accommodation;
	}
	public void setAccommodation(Set<Accommodation> accommodation) {
		this.accommodation = accommodation;
	}
	public Set<Register> getRegister() {
		return register;
	}
	public void setRegister(Set<Register> register) {
		this.register = register;
	}
	public Set<CourseSelect> getCourseSelect() {
		return courseSelect;
	}
	public void setCourseSelect(Set<CourseSelect> courseSelect) {
		this.courseSelect = courseSelect;
	}
	
}
